//
//  DetailActivityViewController.m
//  Frame
//
//  Created by 这是工作本 on 16/1/13.
//  Copyright © 2016年 这是工作本. All rights reserved.
//

#import "DetailActivityViewController.h"

@interface DetailActivityViewController () <UICollectionViewDataSource, UICollectionViewDelegate, UITableViewDataSource, UITableViewDelegate, UMSocialUIDelegate, locationDelegate>
@property (nonatomic, retain) UICollectionView *HcollectionV;
@property (nonatomic, retain) UICollectionView *VcollectionV;
@property (nonatomic, retain) UIView *scrollView;
@property (nonatomic, retain) UIButton *phone;
@property (nonatomic, retain) UIButton *adress;
@property (nonatomic, retain) UIScrollView *scroV;
@property (nonatomic, retain) UIButton *gym;
@property (nonatomic, retain) UIButton *recommend;
@property (nonatomic, retain) UICollectionView *tag;
@property (nonatomic, retain) UICollectionView *picture;
@property (nonatomic, retain) UIButton *comment;
@property (nonatomic, retain) UITableView *tableV;
@property (nonatomic, retain) UIButton *like;
@property (nonatomic, retain) UIImageView *image;
@property (nonatomic, retain) UILabel *content;
@property (nonatomic, assign) CGFloat lat;
@property (nonatomic, assign) CGFloat lng;
@property (nonatomic, assign) BOOL clickLike;
@property (nonatomic, assign) NSInteger begin_scroll;
@property (nonatomic, retain) UIScrollView *scropic;
@property (nonatomic, assign) BOOL clickpic;
@property (nonatomic, retain) NSArray *smallImageArr;
@property (nonatomic, retain) NSArray *bigImageArr;
@property (nonatomic, retain) UIPageControl *pageC;


@end

@implementation DetailActivityViewController

- (void)viewDidAppear:(BOOL)animated
{
    self.like.hidden = NO;
    self.tabBarController.tabBar.hidden = YES;
}

- (void)viewWillDisappear:(BOOL)animated
{
    self.like.hidden = YES;
}

- (void)viewWillAppear:(BOOL)animated
{
    self.navigationController.navigationBar.translucent = YES;
  
}

- (NSArray *)smallImageArr
{
    if (nil == _smallImageArr) {
        
        self.smallImageArr = [NSArray array];
    }
    return _smallImageArr;
}

- (NSArray *)bigImageArr
{
    if (nil == _bigImageArr) {
        
        self.bigImageArr = [NSArray array];
    }
    return _bigImageArr;
}



- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor colorWithRed:255 / 255.0 green:255 /255.0 blue:255 / 255.0 alpha:1.0];
    self.navigationItem.title = @"场馆详情";
    //隐藏自动返回
    self.navigationItem.hidesBackButton = YES;
    //返回按钮
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"but_an.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]style:UIBarButtonItemStylePlain target:self action:@selector(leftBarButtonAction:)];
    //收藏判断
    self.clickLike = YES;
    
    //设置title颜色
    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor colorWithRed:230 / 255.0 green:230 / 255.0 blue:230 / 255.0 alpha:1.0],NSForegroundColorAttributeName,nil]];
    
    //分享
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"fxx.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:@selector(right)];

    //收藏
    self.like = [UIButton buttonWithType:UIButtonTypeCustom];
    self.like = [[UIButton alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - 75 * ScreenWidth, 12, 22 * ScreenWidth, 23 * ScreenHeigth)];
    [self.like setImage:[UIImage imageNamed:@"dzz.png"] forState:UIControlStateNormal];
    [self.like addTarget:self action:@selector(likeAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.navigationController.navigationBar addSubview:self.like];
    
    
    //界面滑动
    
    //滑动scroview
    self.scroV = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 64, [UIScreen mainScreen].bounds.size.width , self.view.frame.size.height)];
    self.scroV.pagingEnabled = YES;
    self.scroV.showsVerticalScrollIndicator = NO;
    self.scroV.contentSize = CGSizeMake(0,  1600 * ScreenHeigth);
    
    [self.view addSubview:self.scroV];
    
    
    //背景
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 160 * ScreenHeigth)];
    view.backgroundColor = [UIColor colorWithRed:255 / 255.0 green:255 / 255.0 blue:255 / 255.0 alpha:1.0];
    [self.scroV addSubview:view];
    
    //图片
    
    self.image = [[UIImageView alloc] initWithFrame:CGRectMake(10 * ScreenWidth, 5 * ScreenHeigth, 123 * ScreenWidth,  89 * ScreenHeigth)];
   
    [view addSubview:self.image];
    
    //名字
    UILabel *name = [[UILabel alloc] initWithFrame:CGRectMake(self.image.frame.origin.x + self.image.frame.size.width + 10 * ScreenWidth, self.image.frame.origin.y + 10 * ScreenHeigth, 200 * ScreenWidth, 15 * ScreenHeigth)];
    name.text = @"欣欣羽毛球运动中心";
    name.textColor = [UIColor colorWithRed:30 / 255.0 green:30 /255.0 blue:30 / 255.0 alpha:1.0];
    name.font = [UIFont systemFontOfSize:15.0 * ScreenWidth];
    [view addSubview:name];
    
    //评分
    UIImageView *score = [[UIImageView alloc] initWithFrame:CGRectMake(name.frame.origin.x, name.frame.origin.y + name.frame.size.height + 10 * ScreenHeigth, 100 * ScreenWidth, 15 * ScreenHeigth)];
    score.image = [UIImage imageNamed:@"iocn_xx03@2x.png"];
    [view addSubview:score];
    
    //福利
    
    UIImageView *free = [[UIImageView alloc] initWithFrame:CGRectMake(score.frame.origin.x, score.frame.origin.y + score.frame.size.height + 10 * ScreenHeigth, 15 * ScreenWidth, 15 * ScreenHeigth)];
    free.image = [UIImage imageNamed:@"iocn_mian.png"];
    [view addSubview:free];
    
    //停车卷
    UILabel *ticket = [[UILabel alloc] initWithFrame:CGRectMake(free.frame.origin.x + free.frame.size.width + 5 * ScreenWidth, free.frame.origin.y, 200 * ScreenWidth, 15 * ScreenHeigth)];
    ticket.text = @"送免费停车卷";
    ticket.textColor = [UIColor colorWithRed:30 / 255.0 green:30 /255.0 blue:30 / 255.0 alpha:1.0];
    ticket.font = [UIFont systemFontOfSize:15.0 * ScreenWidth];
    [view addSubview:ticket];
    
    //分割线
    UIView *div = [[UIView alloc] initWithFrame:CGRectMake(self.image.frame.origin.x, self.image.frame.origin.y + self.image.frame.size.height + 10 * ScreenHeigth, view.frame.size.width - 20 * ScreenWidth, 1 * ScreenHeigth)];
    div.backgroundColor = [UIColor colorWithRed:200 / 255.0 green:200 / 255.0 blue:200 / 255.0 alpha:1.0];
    [view addSubview:div];
    
    
    //说明
    
    self.content = [[UILabel alloc] initWithFrame:CGRectMake(self.image.frame.origin.x , ticket.frame.origin.y + ticket.frame.size.height, view.frame.size.width - 20 * ScreenWidth, 100 * ScreenHeigth)];
    self.content.text = @"送免费停车卷送免费停车卷送免费停车卷送免费停车卷送免费停车卷送免费停车卷送免费停车卷送免费停车卷送免费";
    self.content.textColor = [UIColor colorWithRed:30 / 255.0 green:30 /255.0 blue:30 / 255.0 alpha:1.0];
    self.content.numberOfLines = 0;
    self.content.font = [UIFont systemFontOfSize:13.0 * ScreenWidth];
    [view addSubview:self.content];
    
    //背景
    UIView *flow = [[UIView alloc] initWithFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y + view.frame.size.height + 5 * ScreenHeigth, view.frame.size.width, 160 * ScreenHeigth)];
    flow.backgroundColor = [UIColor colorWithRed:248 / 255.0 green:250 / 255.0 blue:250 / 255.0 alpha:1.0];
    [self.scroV addSubview:flow];
    
    
    
    //横向collectionView
    UICollectionViewFlowLayout *flowL_H = [[UICollectionViewFlowLayout alloc] init];
    //最小行间距
    flowL_H.minimumLineSpacing = 10 * ScreenWidth;
    //滚动方向
    flowL_H.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    //单位大小
    flowL_H.itemSize = CGSizeMake(([UIScreen mainScreen].bounds.size.width - 30 * ScreenWidth) / 4, 40 * ScreenHeigth);
    //与屏幕四边的间距
    flowL_H.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
    
    self.HcollectionV = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 40 * ScreenHeigth) collectionViewLayout:flowL_H];
    //隐藏指示条
    self.HcollectionV.showsHorizontalScrollIndicator = NO;
    //关掉滑动
    self.HcollectionV.scrollEnabled = YES;
    //关闭自动偏移
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.HcollectionV.backgroundColor = [UIColor colorWithRed:248 / 255.0  green:250 / 255.0 blue:250 / 255.0 alpha:1.0];
    self.HcollectionV.contentOffset = CGPointMake([[UIScreen mainScreen] bounds].size.width  / 4,  0);
    //签协议
    self.HcollectionV.delegate = self;
    self.HcollectionV.dataSource = self;
    //注册cell
    [self.HcollectionV registerClass:[ActivityHorCollectionViewCell class] forCellWithReuseIdentifier:@"horizontalCell"];
    self.HcollectionV.bounces = NO;
    self.HcollectionV.pagingEnabled = YES;
    
    [flow addSubview:self.HcollectionV];
    
    //滑条
    self.scrollView = [[UIView alloc] initWithFrame:CGRectMake(5 * ScreenWidth, 39 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width / 4 - 3 * 10 * ScreenWidth, 1 * ScreenHeigth)];
    self.scrollView.backgroundColor = [UIColor colorWithRed:30 / 255.0 green:30 / 255.0 blue:30 / 255.0 alpha:1.0];
    [self.HcollectionV addSubview:self.scrollView];
    
    //纵向collectionView
    UICollectionViewFlowLayout *flowL_V = [[UICollectionViewFlowLayout alloc] init];
    //最小行间距
    flowL_V.minimumLineSpacing = 10 * ScreenWidth;
    //滚动方向
    flowL_V.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    //单位大小
    flowL_V.itemSize = CGSizeMake(60 * ScreenWidth, 80 * ScreenHeigth);
    //与屏幕四边的间距
    flowL_V.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
    
    self.VcollectionV = [[UICollectionView alloc] initWithFrame:CGRectMake(10, self.scrollView.frame.origin.y + self.scrollView.frame.size.height + 10 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width, 100 * ScreenHeigth) collectionViewLayout:flowL_V];
    //隐藏指示条
    self.VcollectionV.showsHorizontalScrollIndicator = NO;
    //关闭自动偏移
    self.automaticallyAdjustsScrollViewInsets = NO;
    //点击状态栏返回顶部
    self.VcollectionV.scrollsToTop = YES;
    self.VcollectionV.bounces = NO;
    self.VcollectionV.backgroundColor = [UIColor colorWithRed:248 / 255.0 green:250 / 255.0 blue:250 / 255.0 alpha:1.0];
    ;
    self.VcollectionV.contentOffset = CGPointMake(60 * ScreenWidth,  0);
    
    //签协议
    self.VcollectionV.delegate = self;
    self.VcollectionV.dataSource = self;
    //注册cell
    [self.VcollectionV registerClass:[ActivityVerCollectionViewCell class] forCellWithReuseIdentifier:@"verticalCell"];
    //整页滑动
    
    self.VcollectionV.pagingEnabled = YES;
    
    [flow addSubview:self.VcollectionV];
    
    
    //背景
    UIView *phone = [[UIView alloc] initWithFrame:CGRectMake(flow.frame.origin.x, flow.frame.origin.y + flow.frame.size.height + 10 * ScreenHeigth, view.frame.size.width, 100 * ScreenHeigth)];
    phone.backgroundColor = [UIColor colorWithRed:255 / 255.0 green:255 / 255.0 blue:255 / 255.0 alpha:1.0];
    [self.scroV addSubview:phone];
    
    
    
    //电话
    
    self.phone = [UIButton buttonWithType:UIButtonTypeCustom];
    self.phone.frame = CGRectMake(0, phone.frame.origin.y +  10 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width, 30 * ScreenHeigth);
    //设置字体大小
    self.phone.titleLabel.font = [UIFont systemFontOfSize:15.0 * ScreenWidth];
    [self.phone setTitleColor:[UIColor colorWithRed:30 / 255.0 green:30 / 255.0 blue:30 / 255.0 alpha:1.0] forState:UIControlStateNormal];
    self.phone.backgroundColor = [UIColor colorWithRed:255 / 255.0 green:255 / 255.0 blue:255 / 255.0 alpha:1.0];
    [self.phone setTitle:@"18607040171" forState:UIControlStateNormal];
    //设置字体靠左
    self.phone.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    //设置字体位置
    self.phone.contentEdgeInsets = UIEdgeInsetsMake(0,35 * ScreenWidth, 0, 0);
    
    [self.phone addTarget:self action:@selector(callAction) forControlEvents:UIControlEventTouchUpInside];
    [self.scroV addSubview:self.phone];
    
    //电话图标
    UIImageView *phonelogo = [[UIImageView alloc] initWithFrame:CGRectMake(12 * ScreenWidth, phone.frame.origin.y + 18 * ScreenHeigth, 15 * ScreenWidth, 15 * ScreenWidth)];
    phonelogo.image = [UIImage imageNamed:@"形状-4@2x.png"];
    [self.scroV addSubview:phonelogo];
    
    //分割线
    UIView *divp = [[UIView alloc] initWithFrame:CGRectMake(phonelogo.frame.origin.x, phonelogo.frame.origin.y + phonelogo.frame.size.height + 10 * ScreenHeigth, view.frame.size.width - 20 * ScreenWidth, 1 * ScreenHeigth)];
    divp.backgroundColor = [UIColor colorWithRed:200 / 255.0 green:200 / 255.0 blue:200 / 255.0 alpha:1.0];
    [self.scroV addSubview:divp];
    
    //箭头
    UIImageView *arrow = [[UIImageView alloc] initWithFrame:CGRectMake(divp.frame.size.width - 20 * ScreenWidth, phonelogo.frame.origin.y, 8 * ScreenWidth, 12 * ScreenHeigth)];
    arrow.image = [UIImage imageNamed:@"形状-1-拷贝@2x.png"];
    [self.scroV addSubview:arrow];
    
    //地址
    
    self.adress = [UIButton buttonWithType:UIButtonTypeCustom];
    self.adress.frame = CGRectMake(0, divp.frame.origin.y +  10 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width, 30 * ScreenHeigth);
    //设置字体大小
    self.adress.titleLabel.font = [UIFont systemFontOfSize:15.0 * ScreenWidth];
    [self.adress setTitleColor:[UIColor colorWithRed:30 / 255.0 green:30 / 255.0 blue:30 / 255.0 alpha:1.0] forState:UIControlStateNormal];
    self.adress.backgroundColor = [UIColor colorWithRed:255 / 255.0 green:255 / 255.0 blue:255 / 255.0 alpha:1.0];
    [self.adress setTitle:@"北京市朝阳区丽都酒店" forState:UIControlStateNormal];
    //设置字体靠左
    self.adress.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    //设置字体位置
    self.adress.contentEdgeInsets = UIEdgeInsetsMake(0,35 * ScreenWidth, 0, 0);
    
    [self.adress addTarget:self action:@selector(adressAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.scroV addSubview:self.adress];
    
    //地址图标
    UIImageView *adresslogo = [[UIImageView alloc] initWithFrame:CGRectMake(12 * ScreenWidth, divp.frame.origin.y + 18 * ScreenHeigth, 15 * ScreenWidth, 15 * ScreenHeigth)];
    adresslogo.image = [UIImage imageNamed:@"椭圆-1@2x.png"];
    [self.scroV addSubview:adresslogo];
    
    //分割线
    UIView *divd = [[UIView alloc] initWithFrame:CGRectMake(adresslogo.frame.origin.x, adresslogo.frame.origin.y + adresslogo.frame.size.height + 10 * ScreenHeigth, view.frame.size.width - 20 * ScreenWidth, 1 * ScreenHeigth)];
    divd.backgroundColor = [UIColor colorWithRed:200 / 255.0 green:200 / 255.0 blue:200 / 255.0 alpha:1.0];
    [self.scroV addSubview:divd];
    
    
    //箭头
    UIImageView *arrowa = [[UIImageView alloc] initWithFrame:CGRectMake(divd.frame.size.width - 20 * ScreenWidth, adresslogo.frame.origin.y, 8 * ScreenWidth, 12 * ScreenHeigth)];
    arrowa.image = [UIImage imageNamed:@"形状-1-拷贝@2x.png"];
    [self.scroV addSubview:arrowa];
    
    //背景
    UIView *relation = [[UIView alloc] initWithFrame:CGRectMake(phone.frame.origin.x, phone.frame.origin.y + phone.frame.size.height + 10 * ScreenHeigth, view.frame.size.width, 242 * ScreenHeigth)];
    relation.backgroundColor = [UIColor colorWithRed:255 / 255.0 green:255 / 255.0 blue:255 / 255.0 alpha:1.0];
    [self.scroV addSubview:relation];
    
    //场馆优势
    
    self.comment = [UIButton buttonWithType:UIButtonTypeCustom];
    self.comment.frame = CGRectMake(0, relation.frame.origin.y +  10 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width, 30 * ScreenHeigth);
    //设置字体大小
    self.comment.titleLabel.font = [UIFont systemFontOfSize:15.0 * ScreenWidth];
    [self.comment setTitleColor:[UIColor colorWithRed:30 / 255.0 green:30 / 255.0 blue:30 / 255.0 alpha:1.0] forState:UIControlStateNormal];
    self.comment.backgroundColor = [UIColor colorWithRed:255 / 255.0 green:255 / 255.0 blue:255 / 255.0 alpha:1.0];
    [self.comment setTitle:@"场馆优势" forState:UIControlStateNormal];
    //设置字体靠左
    self.comment.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    //设置字体位置
    self.comment.contentEdgeInsets = UIEdgeInsetsMake(0,35 * ScreenWidth, 0, 0);
    
    [self.comment addTarget:self action:@selector(phoneAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.scroV addSubview:self.comment];
    
    //场馆优势图标
    UIImageView *gymlogo = [[UIImageView alloc] initWithFrame:CGRectMake(12 * ScreenWidth, relation.frame.origin.y + 18 * ScreenHeigth, 15 * ScreenWidth, 15 * ScreenHeigth)];
    gymlogo.image = [UIImage imageNamed:@"44444@2x.png"];
    [self.scroV addSubview:gymlogo];
    
    //分割线
    UIView *divg = [[UIView alloc] initWithFrame:CGRectMake(gymlogo.frame.origin.x, gymlogo.frame.origin.y + gymlogo.frame.size.height + 10 * ScreenHeigth, view.frame.size.width - 20 * ScreenWidth, 1 * ScreenHeigth)];
    divg.backgroundColor = [UIColor colorWithRed:200 / 255.0 green:200 / 255.0 blue:200 / 255.0 alpha:1.0];
    [self.scroV addSubview:divg];
    
    //标签
    UICollectionViewFlowLayout *tag_V = [[UICollectionViewFlowLayout alloc] init];
    //最小行间距
    tag_V.minimumLineSpacing = 20 * ScreenWidth;
    //滚动方向
    tag_V.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    //单位大小
    tag_V.itemSize = CGSizeMake(70 * ScreenWidth, 15 * ScreenHeigth);
    //与屏幕四边的间距
    tag_V.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
    
    self.tag = [[UICollectionView alloc] initWithFrame:CGRectMake(10 * ScreenWidth, divg.frame.origin.y + divg.frame.size.height + 10 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width, 15 * ScreenHeigth) collectionViewLayout:tag_V];
    //隐藏指示条
    self.tag.showsHorizontalScrollIndicator = NO;
    //关闭自动偏移
    self.automaticallyAdjustsScrollViewInsets = NO;
    //点击状态栏返回顶部
    self.tag.scrollsToTop = YES;
    self.tag.bounces = NO;
    self.tag.backgroundColor = [UIColor colorWithRed:255 / 255.0 green:255 / 255.0 blue:255 / 255.0 alpha:1.0];
    ;
    self.tag.contentOffset = CGPointMake(70 * ScreenWidth,  0);
    
    //签协议
    self.tag.delegate = self;
    self.tag.dataSource = self;
    //注册cell
    [self.tag registerClass:[tagCollectionViewCell class] forCellWithReuseIdentifier:@"tagCell"];
    //整页滑动
    
    self.tag.pagingEnabled = YES;
    
    [self.scroV addSubview:self.tag];
    
    
    //分割线
    UIView *divt = [[UIView alloc] initWithFrame:CGRectMake(gymlogo.frame.origin.x, self.tag.frame.origin.y + self.tag.frame.size.height + 10 * ScreenHeigth, view.frame.size.width - 20 * ScreenWidth, 1 * ScreenHeigth)];
    divt.backgroundColor = [UIColor colorWithRed:200 / 255.0 green:200 / 255.0 blue:200 / 255.0 alpha:1.0];
    [self.scroV addSubview:divt];
    
    //相关推荐
    
    self.comment = [UIButton buttonWithType:UIButtonTypeCustom];
    self.comment.frame = CGRectMake(0, divt.frame.origin.y +  10 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width, 30 * ScreenHeigth);
    //设置字体大小
    self.comment.titleLabel.font = [UIFont systemFontOfSize:15.0 * ScreenWidth];
    [self.comment setTitleColor:[UIColor colorWithRed:30 / 255.0 green:30 / 255.0 blue:30 / 255.0 alpha:1.0] forState:UIControlStateNormal];
    self.comment.backgroundColor = [UIColor colorWithRed:255 / 255.0 green:255 / 255.0 blue:255 / 255.0 alpha:1.0];
    [self.comment setTitle:@"相关推荐" forState:UIControlStateNormal];
    //设置字体靠左
    self.comment.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    //设置字体位置
    self.comment.contentEdgeInsets = UIEdgeInsetsMake(0,35 * ScreenWidth, 0, 0);
    
    [self.comment addTarget:self action:@selector(phoneAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.scroV addSubview:self.comment];
    
    //相关推荐图标
    UIImageView *recommendLogo = [[UIImageView alloc] initWithFrame:CGRectMake(12 * ScreenWidth, divt.frame.origin.y + 18 * ScreenHeigth, 15 * ScreenWidth, 15 * ScreenHeigth)];
    recommendLogo.image = [UIImage imageNamed:@"形状-8@2x.png"];
    [self.scroV addSubview:recommendLogo];
    
    //分割线
    UIView *divr = [[UIView alloc] initWithFrame:CGRectMake(recommendLogo.frame.origin.x, recommendLogo.frame.origin.y + recommendLogo.frame.size.height + 10 * ScreenHeigth, view.frame.size.width - 20 * ScreenWidth, 1 * ScreenHeigth)];
    divr.backgroundColor = [UIColor colorWithRed:200 / 255.0 green:200 / 255.0 blue:200 / 255.0 alpha:1.0];
    [self.scroV addSubview:divr];
    
    //推荐场馆照片
    UICollectionViewFlowLayout *picture_V = [[UICollectionViewFlowLayout alloc] init];
    //最小行间距
    picture_V.minimumLineSpacing = 20 * ScreenWidth;
    //滚动方向
    picture_V.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    //单位大小
    picture_V.itemSize = CGSizeMake(115 * ScreenWidth, 90 * ScreenHeigth);
    //与屏幕四边的间距
    picture_V.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
    
    self.picture = [[UICollectionView alloc] initWithFrame:CGRectMake(10 * ScreenWidth, divr.frame.origin.y + divr.frame.size.height + 10 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width, 90 * ScreenHeigth) collectionViewLayout:picture_V];
    //隐藏指示条
    self.picture.showsHorizontalScrollIndicator = NO;
    //关闭自动偏移
    self.automaticallyAdjustsScrollViewInsets = NO;
    //点击状态栏返回顶部
    self.picture.scrollsToTop = YES;
    self.picture.bounces = NO;
    self.picture.backgroundColor = [UIColor colorWithRed:255 / 255.0 green:255 / 255.0 blue:255 / 255.0 alpha:1.0];
    ;
    self.picture.contentOffset = CGPointMake(115 * ScreenWidth,  0);
    
    //签协议
    self.picture.delegate = self;
    self.picture.dataSource = self;
    //注册cell
    [self.picture registerClass:[PictureCollectionViewCell class] forCellWithReuseIdentifier:@"pictureCell"];
    //整页滑动
    
    self.picture.pagingEnabled = YES;
    
    [self.scroV addSubview:self.picture];

    
    //背景
    UIView *Comment = [[UIView alloc] initWithFrame:CGRectMake(0, relation.frame.origin.y + relation.frame.size.height + 10 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width, 44 * ScreenHeigth)];
    Comment.backgroundColor = [UIColor colorWithRed:255 / 255.0 green:255 / 255.0 blue:255 / 255.0 alpha:1.0];
    [self.scroV addSubview:Comment];
 
    //评论
    self.comment = [UIButton buttonWithType:UIButtonTypeCustom];
    self.comment.frame = CGRectMake(0, Comment.frame.origin.y +  10 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width, 30 * ScreenHeigth);
    //设置字体大小
    self.comment.titleLabel.font = [UIFont systemFontOfSize:15.0 * ScreenWidth];
    [self.comment setTitleColor:[UIColor colorWithRed:30 / 255.0 green:30 / 255.0 blue:30 / 255.0 alpha:1.0] forState:UIControlStateNormal];
    self.comment.backgroundColor = [UIColor colorWithRed:255 / 255.0 green:255 / 255.0 blue:255 / 255.0 alpha:1.0];
    [self.comment setTitle:@"评论" forState:UIControlStateNormal];
    //设置字体靠左
    self.comment.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    //设置字体位置
    self.comment.contentEdgeInsets = UIEdgeInsetsMake(0,35 * ScreenWidth, 0, 0);
    
    [self.comment addTarget:self action:@selector(phoneAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.scroV addSubview:self.comment];
    
    //评论图标
    UIImageView *commentLogo = [[UIImageView alloc] initWithFrame:CGRectMake(12 * ScreenWidth, Comment.frame.origin.y + 18 * ScreenHeigth, 3 * ScreenWidth, 15 * ScreenHeigth)];
    commentLogo.image = [UIImage imageNamed:@"矩形-12@2x.png"];
    [self.scroV addSubview:commentLogo];
    
    //分割线
    UIView *divc = [[UIView alloc] initWithFrame:CGRectMake(commentLogo.frame.origin.x, commentLogo.frame.origin.y + recommendLogo.frame.size.height + 10 * ScreenHeigth, view.frame.size.width - 20 * ScreenWidth, 1 * ScreenHeigth)];
    divc.backgroundColor = [UIColor colorWithRed:200 / 255.0 green:200 / 255.0 blue:200 / 255.0 alpha:1.0];
    [self.scroV addSubview:divc];
    
    //评论内容
    
    
    self.tableV = [[UITableView alloc] initWithFrame:CGRectMake(0, divc.frame.origin.y + divc.frame.size.height, [UIScreen mainScreen].bounds.size.width, 500 * ScreenHeigth) style:UITableViewStylePlain];
    self.tableV.dataSource = self;
    self.tableV.delegate = self;
    self.tableV.backgroundColor = [UIColor colorWithRed:255 / 255.0 green:255 / 255.0 blue:255 / 255.0 alpha:1.0];
    [self.scroV addSubview:self.tableV];
    
    
    
    
    
    
    
    

    
    
}

//电话
- (void)callAction{
    NSString *number = @"18607040171";// 此处读入电话号码
//     NSString *num = [[NSString alloc]initWithFormat:@"tel://%@",number]; //number为号码字符串 如果使用这个方法结束电话之后会进入联系人列表
    
    NSString *num = [[NSString alloc]initWithFormat:@"telprompt://%@",number]; //而这个方法则打电话前先弹框 是否打电话 然后打完电话之后回到程序中 网上说这个方法可能不合法 无法通过审核
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:num]]; //拨号

    
}

//获取经纬度
- (void)latitude:(CGFloat)latitude longtitude:(CGFloat)longtitude
{
    self.lat = latitude;
    self.lng = longtitude;
}

//喜欢

-(void)likeAction:(UIButton *)sender
{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    
    NSDictionary *dict = @{@"modelId":self.modelId, @"modelKey":@"venue"};
    
    [manager POST:@"http://192.168.1.157:8080/api/center?userId=3339WrRIAYfv9wPeGqC&equipment=ios&requestType=Add_Collection_Api&token=74214cd04c081efd29a1f55d3d7b6c3a" parameters:dict success:^(AFHTTPRequestOperation * _Nonnull operation, id  _Nonnull responseObject) {
        
        if (YES == self.clickLike) {
            
        [self.like setImage:[UIImage imageNamed:@"iocn_shouchang.png"] forState:UIControlStateNormal];
            self.clickLike = NO;
 
            
        } else
            
        {
            [self.like setImage:[UIImage imageNamed:@"dzz.png"] forState:UIControlStateNormal];
            self.clickLike = YES;

            
        }
        
    } failure:^(AFHTTPRequestOperation * _Nullable operation, NSError * _Nonnull error) {
        
        
    }];

    
}




//点击触发
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    if (self.HcollectionV == collectionView) {
        //动画滑块 点击改变滑块位置
        [UIView animateWithDuration:0.2 animations:^{

            self.scrollView.frame = CGRectMake(5 * ScreenWidth + ([UIScreen mainScreen].bounds.size.width / 4) * indexPath.row, 39 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width / 4 - 3 * 10 * ScreenWidth, 1 * ScreenHeigth);

        }];
        //改变collection的偏移量
        [self.VcollectionV setContentOffset:CGPointMake(self.view.frame.size.width * indexPath.row, 0) animated:YES];
        //滑块一起移动->体验非常好
        self.begin_scroll = indexPath.row;
        [collectionView scrollToItemAtIndexPath:indexPath atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:YES];
        
        AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
        
        NSDictionary *dict = @{@"id":self.modelId, @"projectId":self.projectId};
        
        [manager POST:@"http://192.168.1.157:8080/api/center?userId=3339WrRIAYfv9wPeGqC&equipment=ios&requestType=Switch_Field_Api&token=74214cd04c081efd29a1f55d3d7b6c3a" parameters:dict success:^(AFHTTPRequestOperation * _Nonnull operation, id  _Nonnull responseObject) {
            
            self.smallImageArr = [responseObject objectForKey:@"smallImgSrcs"];
            self.bigImageArr = [responseObject objectForKey:@"bigImgSrcs"];
            [self.image sd_setImageWithURL:[self.smallImageArr objectAtIndex:0] placeholderImage:nil];
            UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(photoBig)];
            //添加手势
            self.image.userInteractionEnabled = YES;

            [self.image addGestureRecognizer:tap];
            
        } failure:^(AFHTTPRequestOperation * _Nullable operation, NSError * _Nonnull error) {
            
            
        }];

        
        

    }
    
    if (self.VcollectionV == collectionView) {
        
        
        //添加水波动画
        CATransition *ansition = [CATransition animation];
        ansition.duration = 1.0;
        ansition.type = @"rippleEffect";
        [self.view.window.layer addAnimation:ansition forKey:nil];
        
        
        BookingViewController *book = [[BookingViewController alloc] init];
        [self.navigationController pushViewController:book animated:YES];
        
    }


}



//地图

- (void)adressAction:(UIButton *)sender
{
    //添加水波动画
    CATransition *ansition = [CATransition animation];
    ansition.duration = 1.0;
    ansition.type = @"rippleEffect";
    [self.view.window.layer addAnimation:ansition forKey:nil];
    
    MapViewController *map = [[MapViewController alloc] init];
    
    [self.navigationController pushViewController:map animated:YES];

    
}

//点击图片查看全部
- (void)photoBig
{
    self.scropic = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
    self.scropic.backgroundColor = [UIColor blackColor];
    self.scropic.pagingEnabled = YES;
    //关闭边缘反弹
    self.scropic.bounces = NO;
    

    //签协议拽动
    self.scropic.delegate = self;
    [self.view addSubview:self.scropic];
    
    
    //加两个图片槽
    self.scropic.contentSize = CGSizeMake([UIScreen mainScreen].bounds.size.width * self.bigImageArr.count + 2, 0);
    
//    self.image = [[UIImageView alloc] initWithFrame:CGRectMake(0, 200 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width,  200 * ScreenHeigth)];
//    [self.image sd_setImageWithURL:[self.bigImageArr objectAtIndex:0] placeholderImage:nil];
//    [self.scropic addSubview:self.image];
    self.scropic.contentOffset = CGPointMake([UIScreen mainScreen].bounds.size.width , 0);

    
    //加两个图片
    for (NSInteger i = 0  ; i < self.bigImageArr.count + 2; i++) {
        
        self.image = [[UIImageView alloc] initWithFrame:CGRectMake(0, 200 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width,  200 * ScreenHeigth)];
        
        
        //加一个首尾图片
        if (0 == i) {
            [self.image sd_setImageWithURL:[self.bigImageArr objectAtIndex:self.bigImageArr.count - 1] placeholderImage:nil];
            
            [self.scropic addSubview:self.image];
        }else if (self.bigImageArr.count + 1 == i)
        {
            
            [self.image sd_setImageWithURL:[self.bigImageArr objectAtIndex:0] placeholderImage:nil];
            
            [self.scropic addSubview:self.image];
            
        }else {
            
            [self.image sd_setImageWithURL:[self.bigImageArr objectAtIndex:i - 1] placeholderImage:nil];
            
            [self.scropic addSubview:self.image];
        }
        
        
    }

    self.pageC = [[UIPageControl alloc] initWithFrame:CGRectMake(100 * ScreenWidth, self.image.frame.origin.y + self.image.frame.size.height - 40 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width - 200 * ScreenWidth, 20 * ScreenHeigth)];
    self.pageC.numberOfPages = self.bigImageArr.count;
    self.pageC.pageIndicatorTintColor = [UIColor colorWithRed:230 / 255.0 green:230 / 255.0 blue:230 / 255.0 alpha:1.0];
    self.pageC.currentPageIndicatorTintColor = [UIColor colorWithRed:200 / 255.0 green:200 / 255.0 blue:200 / 255.0 alpha:1.0];
    [self.scropic addSubview:self.pageC];

    
    
    


    
}

//减速结束
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    
    //计时器停止后pageC和scroV关联
    self.pageC.currentPage = self.scroV.contentOffset.x / [UIScreen mainScreen].bounds.size.width - 1;

    if (self.bigImageArr.count + 1  == self.scropic.contentOffset.x / [UIScreen mainScreen].bounds.size.width) {
        self.scropic.contentOffset = CGPointMake([UIScreen mainScreen].bounds.size.width , 0);
        self.pageC.currentPage = 0;

    }
    else if (0 == self.scropic.contentOffset.x / [UIScreen mainScreen].bounds.size.width)
        
    {
        ;
        self.scropic.contentOffset = CGPointMake([UIScreen mainScreen].bounds.size.width * self.bigImageArr.count + 1, 0);
          self.pageC.currentPage = self.bigImageArr.count - 1;
    }

}

- (void)leftBarButtonAction:(UIBarButtonItem *)sender
{
    [self.navigationController popViewControllerAnimated:YES];
    
}

- (void)share
{
    
    
}

- (void)right
{
    [self shareFindWithTittle:self.content.text withimage:self.image.image];
}

- (void)phoneAction:(UIButton *)sender
{
    
}



- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    if (self.HcollectionV == collectionView) {
        
        return 4;
        
    }
    
    if (self.tag == collectionView) {
        
        return 3;
    }
    
    if (self.picture == collectionView) {
        
        return 3;
    }
    
    else {
        
        return 8;
    }
}


- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    if (self.HcollectionV == collectionView) {
        
        ActivityHorCollectionViewCell *hor = [collectionView dequeueReusableCellWithReuseIdentifier:@"horizontalCell" forIndexPath:indexPath];
        
        
        return hor;
        
    }
    if (self.tag == collectionView) {
        
        tagCollectionViewCell *tag = [collectionView dequeueReusableCellWithReuseIdentifier:@"tagCell" forIndexPath:indexPath];
        
        return tag;
    }
    
    if (self.picture == collectionView) {
        
        tagCollectionViewCell *picture = [collectionView dequeueReusableCellWithReuseIdentifier:@"pictureCell" forIndexPath:indexPath];
        
        return picture;

        
    }
    
    else {
        
        
        ActivityVerCollectionViewCell *ver = [collectionView dequeueReusableCellWithReuseIdentifier:@"verticalCell" forIndexPath:indexPath];
        
        ver.backgroundColor = [UIColor colorWithRed:255 / 255.0 green:255 / 255.0 blue:255 / 255.0 alpha:1.0];
        
        return ver;
    }
}



- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 150 * ScreenHeigth;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    
    
    NSString *cellStr = @"cell";
    CommentTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellStr];
    if (nil == cell) {
        
        cell = [[CommentTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellStr];
    }
    cell.backgroundColor = [UIColor colorWithRed:255 / 255.0 green:255 / 255.0 blue:255 / 255.0 alpha:1.0];
    //清除选中色
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return cell;

    
}



//分享图片和介绍
- (void)shareFindWithTittle:(NSString *)str withimage:(UIImage *)image
{

    
    NSArray *array = @[UMShareToSina, UMShareToDouban, UMShareToQQ, UMShareToTencent, UMShareToWechatSession, UMShareToQzone, UMShareToEmail, UMShareToSms, UMShareToFacebook, UMShareToWechatTimeline];
    [UMSocialSnsService presentSnsIconSheetView:self appKey:@"569f009ce0f55a938f001d35" shareText:str shareImage:image shareToSnsNames:array delegate:self];
    
}





- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
